package com.etc.test

import org.apache.spark.{SparkConf, SparkContext}

/**
 * @Author kalista
 * @Description
 * @Date 2021/5/23  10:34
 * */
object WordCount {

  def main(args: Array[String]): Unit = {
    val sparkconf = new SparkConf().setMaster("local").setAppName("wordcount")
    val sc = new SparkContext(sparkconf)
    val strrdd = sc.textFile("e:\\a.txt")
    strrdd.flatMap(x=>x.split(",")).map((_,1)).reduceByKey(_+_).foreach(println(_))
    strrdd.checkpoint()
    strrdd.persist()
    sc.stop()
  }

}
